package com.carrey.common.utiltest;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

import com.carrey.common.utilsrk.DateUtil;

public class Datetest {
	@Test
	public void dateutiltest() throws ParseException {
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
		int age = DateUtil.getAge(simpleDateFormat.parse("2000-01-01"));
		System.out.println("年龄"+age);
		System.out.println("月初日期"+DateUtil.getDateByMonthInit(simpleDateFormat.parse("2000-01-01")));
		System.out.println("月末日期"+DateUtil.getDateByMonthInit(simpleDateFormat.parse("2000-01-06")));
		System.out.println("未来日期离今天还剩的天数"+DateUtil.getDaysByFuture (simpleDateFormat.parse("2021-03-07")));
		System.out.println("过去日期离今天还剩的天数"+DateUtil.getDaysByDeparted(simpleDateFormat.parse("2021-03-01")));
	}
}
